define(function(require,exports,module){
    var G = require('./g');
    var $ = require('jquery');
    var S = require('swiper');
    var W = require('./jweixin');


    function Relative(){
        this.init.call(this);
    }

    Relative.prototype = {
        init : function(){
            this.swiper = null;
            this.initPage();
            this.initEvent();
        },
        initEvent : function(){
            var _this = this;
            $('#test').click(function(){
                _this.updateSwiper();
            });
        },
        initPage : function(){
            var wh = $(document).height();
            $('#mySwiper').height(wh - 158);
            this.initSwiper();
        },
        initSwiper : function(){
            var _this = this;
            this.swiper = new S('.swiper-container', {
                pagination: '.swiper-pagination',
                paginationClickable: true,
                //onTouchEnd : function(swiper){
                //    console.log(swiper.isEnd);
                //    if(swiper.isEnd){
                //        _this.updateSwiper();
                //    }
                //},
                onReachEnd: function(swiper){
                    alert('到了最后一个slide');
                }
            });
        },
        updateSwiper : function(){
            $('.swiper-wrapper').html('<div class="swiper-slide" style="background:url(images/default_cover.png) left center no-repeat;background-size:100% auto;"></div>');
            this.swiper.update();
        }
    };

    new Relative();
});